import type { LoginData, LoginResponse } from '@/types/login';
import request from '@/http'; // 假设已正确导入请求实例

// 注册
export const register = (data: LoginData): Promise<LoginResponse> => {
  return request({
    url: '/api/register',
    method: 'POST',
    data
  });
};

// 登录
export const login = (data: LoginData): Promise<LoginResponse> => {
  return request({
    url: '/api/login',
    method: 'POST',
    data
  });
};

// 发送验证码
export const sendVerificationCodeAPI = (data: {
  account: string | number;
  email: string;
}) => {
  return request.post('/send-code', data);
};

// 验证验证码
export const verifyCodeAPI = (data: {
  account: string | number;
  code: string;
}) => {
  return request.post('/verify-code', data);
};

// 重置密码
export const resetPasswordAPI = (data: {
  account: string | number;
  code: string;
  password: string;
}) => {
  return request.post('/reset-password', data);
};